package ch7;

interface Actor {
    void act();
}

/**
 * @author ANG.YU
 * @date 2020-08-13 20:48
 */
public class Transmogrify {
    public static void main(String[] args) {
        Stage s = new Stage();
        s.go();
        s.change();
        s.go();
    }
}

class HappyActor implements Actor {
    @Override
    public void act() {
        System.out.println("HappyActor");
    }
}

class SadActor implements Actor {
    @Override
    public void act() {
        System.out.println("SadActor");
    }
}

class Stage {
    Actor a = new HappyActor();

    void change() {
        a = new SadActor();
    }

    void go() {
        a.act();
    }
}